package com.springboot.uav.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.springboot.uav.entity.Address;
import com.springboot.uav.mapper.AddressMapper;
import com.springboot.uav.service.MyPageAddressService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MyPageAddressServiceImpl extends ServiceImpl<AddressMapper, Address> implements MyPageAddressService{
    @Override
    public List<Address> getAddressListByUserId(Integer userId) {
        QueryWrapper<Address> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("user_id", userId);
        return list(queryWrapper);
    }

    @Override
    public boolean saveAddress(Address address) {
        return save(address);
    }

    @Override
    public boolean deleteAddressById(Integer addId) {
        return removeById(addId);
    }
}

